/**
 * Created by q on 2016/10/9.
 */
import Vue from 'vue'
import Vuex from 'vuex'
import createLogger from 'vuex/dist/logger'
import mutations from './mutations'
import actions from './actions'
import getters from './getters'
import {getStore} from '../libs/util'


Vue.use(Vuex)

const debug = process.env.NODE_ENV !== 'production'

let state = {
  token: '',
  userInfo: {},
  userprof:{},
  dept:{},
  role:{},
  org:{},
  accesslist:[],
  isLogin:  !!getStore('token'),
  captchaUrl: '',
  cptId: '',
  msg: '',
  headerNeeded: true,
  menuNeeded: true,
  isLoginPage: false,
  mobileMode: false,
  menuCollapse: true,
  toggle:true,
  posts: [],
  roomid: '',
  socket: null,
  wsStatus: 0,
  onlineCount: 0,
  onlineUsers: [],
  msgArr: [],
}


export default new Vuex.Store({
  state,
  mutations,
  getters,
  actions,
  strict: false,
  plugins: debug ? [createLogger()] : []
})

